<template>
	<view>
		<view class="flash-good">
			<view class="flash-sale">
				<view class="line"></view>
				<view class="flash-title" @click="onSkip('flash')">
					<view class="pictrue">
						<image src="/static/xsqg_title.png" mode=""></image>
					</view>
					<view class="date-time">
						<text class="time">02</text>
						<text class="da">:</text>
						<text class="time">15</text>
						<text class="da">:</text>
						<text class="time">55</text>
					</view>
				</view>
				<view class="goods-list">
					<view class="list" @click="onSkip('goods')" v-for="(item, index) in promotionList" :key="index">
						<view class="pictrue">
							<image :src="item.url"></image>
						</view>
						<view class="price">
							<text class="selling-price">￥{{item.price}}</text>
							<text class="original-price">￥{{item.mktprice}}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="good-choice">
				<!-- @click="onSkip('GoodChoice')" -->
				<view class="goods-title" >
					<view class="title">
						<text>好货精选</text>
					</view>
					<view class="describe">
						<text>全场</text>
						<text class="num">1</text>
						<text>折起</text>
					</view>
				</view>
				<view class="goods-list">
					<view class="list" @click="onSkip('goods')">
						<view class="pictrue">
							<image src="/static/img/goods_03.png"></image>
						</view>
						<view class="price">
							<text class="selling-price">￥59</text>
							<text class="original-price">￥999</text>
						</view>
					</view>
					<view class="list" @click="onSkip('goods')">
						<view class="pictrue">
							<image src="/static/img/goods_08.png"></image>
						</view>
						<view class="price">
							<text class="selling-price">￥59</text>
							<text class="original-price">￥999</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'flash-good',
		components: {},
		data() {
			return {

			}
		},
		props: {
			promotionList: {
				type: Array,
				default: () => []
			}
		},
		computed: {

		},
		methods: {
			onSkip(type) {
				switch (type) {
					case "mess":
						uni.navigateTo({
							url: "/pages/Message/Message",
						});
						break;
					case "paycode":
						uni.navigateTo({
							url: "/pages/PaymentCode/PaymentCode",
						});
						break;
					case "menu":
						uni.navigateTo({
							url: "/pages/SearchGoodsList/SearchGoodsList",
						});
						break;
					case "inform":
						break;
					case "flash":
						uni.navigateTo({
							url: "/pages/home/promotion/promotion",
						});
						break;
					case "GoodChoice":
						uni.navigateTo({
							url: "/pages/GoodChoice/GoodChoice",
						});
						break;
					case "goods":
						uni.navigateTo({
							url: "/pages/GoodsDetails/GoodsDetails",
							animationType: "zoom-fade-out",
							animationDuration: 200,
						});
						break;
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	.flash-good {
		display: flex;
		align-items: center;
		padding: 0 25rpx;
		height: 330rpx;
		background-color: #FFFFFF;
		border-bottom: 16rpx solid #f9f9f9;

		.flash-sale {
			position: relative;
			width: 50%;
			height: 100%;

			.line {
				position: absolute;
				right: 0;
				top: 50%;
				width: 2rpx;
				height: 80%;
				background-color: #f9f9f9;
				transform: translate(0, -50%);
			}

			.flash-title {
				display: flex;
				align-items: center;
				// justify-content: space-between;
				width: 100%;
				height: 80rpx;

				.pictrue {
					display: flex;
					align-items: center;
					height: 100%;

					image {
						width: 118rpx;
						height: 28rpx;
					}
				}

				.date-time {
					display: flex;
					align-items: center;
					margin-left: 50rpx;

					.time {
						display: flex;
						align-items: center;
						justify-content: center;
						width: 40rpx;
						height: 40rpx;
						background-color: $price-clor;
						font-size: 24rpx;
						color: #FFFFFF;
						border-radius: 6rpx;
					}

					.da {
						font-size: 34rpx;
						color: #212121;
						margin: 0 6rpx;
					}
				}
			}

			.goods-list {
				display: flex;
				width: 100%;
				height: 220rpx;

				.list {
					width: 50%;
					height: 100%;

					.pictrue {
						width: 100%;
						height: 70%;

						image {
							width: 150rpx;
							height: 150rpx;
						}
					}

					.price {
						display: flex;
						// align-items: center;
						flex-direction: column;
						width: 100%;
						height: 30%;

						.selling-price {
							font-size: 28rpx;
							font-weight: bold;
							color: $price-clor;
						}

						.original-price {
							font-size: 24rpx;
							text-decoration: line-through;
							color: #bbbaba;
							margin-left: 10rpx;
						}
					}
				}
			}
		}

		.good-choice {
			width: 50%;
			height: 100%;

			.goods-title {
				display: flex;
				align-items: center;
				padding: 0 20rpx;
				height: 80rpx;

				.title {
					display: flex;
					align-items: center;

					text {
						font-size: 28rpx;
						color: #4c4b4b;
					}
				}

				.describe {
					display: flex;
					align-items: center;
					margin-left: 10rpx;

					text {
						font-size: 24rpx;
						color: #979696;
					}

					.num {
						display: flex;
						align-items: center;
						justify-content: center;
						margin: 0 6rpx;
						width: 30rpx;
						height: 30rpx;
						background-color: $price-clor;
						color: #FFFFFF;
						border-radius: 6rpx;
					}
				}
			}

			.goods-list {
				display: flex;
				width: 100%;
				height: 220rpx;

				.list {
					width: 50%;
					height: 100%;

					.pictrue {
						width: 100%;
						height: 70%;

						image {
							width: 150rpx;
							height: 150rpx;
						}
					}

					.price {
						display: flex;
						align-items: center;
						width: 100%;
						height: 30%;

						.selling-price {
							font-size: 28rpx;
							font-weight: bold;
							color: $price-clor;
						}

						.original-price {
							font-size: 24rpx;
							text-decoration: line-through;
							color: #bbbaba;
							margin-left: 10rpx;
						}
					}
				}
			}
		}
	}
</style>
